<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">优惠券消码列表</block>
		</cu-custom>
		
		<view class="cu-list menu" :class="[menuBorder?'sm-border':'',menuCard?'card-menu margin-top':'']">
			
			<view class="cu-item cur h135" v-for="(item,index) in list" :key='index'>
				<view class="cu-avatar radius lg mr10" :style="'background-image:url('+ item.head_photo +');'">
					<view class="cu-tag badge">{{item.real_name}}</view>
				</view>
				<view class="content">
					<view>
						<view class="text-cut">{{item.content}}</view>
					</view>
					<view class="text-gray text-sm flex">
						<text class="cuIcon-refund text-orange margin-right-xs"></text>
						<view class="text-cut"> 使用金额:{{item.user_money}}<text class="cuIcon-sponsor text-orange margin-right-xs"></text> 剩余金额:{{item.residuemoney}}</view></view>
				</view>
				<view class="action">
					<view class="text-grey text-xs">{{getDateString(item.used_time)}}</view>
				</view>
			</view>
			
		</view>
		
		
	</view>
</template>

<script>
	import {
		discountList
	} from '../../../../api/business.js'
	export default {
		data() {
			return {
				list:[],
				menuBorder:false,
				menuCard:false
			}
		},
		onShow: function() {
			this.getList()
		},
		methods: {
			getList(){
				discountList().then(ret=>{
					let rest = ret.data
					if(rest.errcode == 0) {
						this.list = rest.data.results
					}
				})
			},
			getDateString(data){
				return this.$common.xeUtils.toDateString(data)
			}
		}
	}
</script>

<style>
.mr10{
	margin-right: 20rpx;
}
.h135{
	height: 135rpx;
}
</style>
